package com.andy.common.extend

import android.content.Context
import androidx.core.content.ContextCompat

/**
 * 通过资源ID 获取颜色值
 */
fun Context.colorFromRes(colorId: Int) = ContextCompat.getColor(this, colorId)

/**
 * 通过资源ID 获取图片 Drawable
 */
fun Context.drawableFromRes(drawableId: Int) = ContextCompat.getDrawable(this, drawableId)

/**
 * 通过资源ID 获取文字
 */
fun Context.stringFromRes(stringId: Int) = resources.getString(stringId)

/**
 * 通过资源ID 获取dimension
 */
fun Context.dimensionFromRes(dimensionId: Int) = resources.getDimension(dimensionId)